#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int f(int a[], int n, int* pmax, int* pmin)
{
	*pmin = a[0];
	*pmax = a[0];
	int sum = a[0];
	int i = 0;
	for (i = 1;i < n;i++)
	{
		if (a[i] > *pmax)
			*pmax = a[i];
		else if (a[i] < *pmin)
			*pmin = a[i];
		sum += a[i];
	}
	return sum;
}

int main()
{
	int sum = 0;
	int min = 0;
	int max = 0;
	int N = 0;
	int arr[50] = { 0 };
	scanf("%d", &N);
	int i = 0;
	for (i = 0;i < N;i++)
	{
		scanf("%d", &arr[i]);
	}
	sum = f(arr, N, &max, &min);
	printf("%d %d %d", max, min, sum);

	return 0;
}